import Text.ParserCombinators.Table
import Control.Monad
import Control.Monad.Error

mainE :: ErrorT String (IO) ()
mainE = do
  xs <- readTableE "example.txt" $ do
    x <- int
    y <- mayBe int
    z <- mayBe idouble
    return (x,y,z)
  forM_ xs $ \(x,y,z) -> do
    liftIO $ print $ "x = " ++ show x ++ "; y = " ++ show y ++ "; z = " ++ show z

main = runErrorT mainE
